package com.sm.filemanagelibrary.model;

import android.os.Parcel;
import android.os.Parcelable;

import java.io.Serializable;
import java.util.List;

/**
 * created by zhud on 2019/9/27
 */
public class FileCacheEntity implements Parcelable {
    public List<FileEntity> fileList;
    public String path;
    public int lastPosition = 0;
    public int lastOffset = 0;

    public FileCacheEntity(String path) {
        this.path = path;
    }

    public FileCacheEntity() {
    }

    protected FileCacheEntity(Parcel in) {
        fileList = in.createTypedArrayList(FileEntity.CREATOR);
        path = in.readString();
        lastPosition = in.readInt();
        lastOffset = in.readInt();
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeTypedList(fileList);
        dest.writeString(path);
        dest.writeInt(lastPosition);
        dest.writeInt(lastOffset);
    }

    @Override
    public int describeContents() {
        return 0;
    }

    public static final Creator<FileCacheEntity> CREATOR = new Creator<FileCacheEntity>() {
        @Override
        public FileCacheEntity createFromParcel(Parcel in) {
            return new FileCacheEntity(in);
        }

        @Override
        public FileCacheEntity[] newArray(int size) {
            return new FileCacheEntity[size];
        }
    };
}
